package p3_entities;


import java.io.Serializable;
import javax.persistence.*;

import com.sun.xml.bind.CycleRecoverable;

import java.math.BigDecimal;
import java.util.Date;


/**
 * The persistent class for the lindenmovements database table.
 * 
 */
@Entity
@Table(name="lindenmovements")

@NamedQuery(name="getLindenMovements", 
		query="SELECT x FROM Lindenmovement x WHERE x.id=:userId")
		
public class Lindenmovement implements Serializable, CycleRecoverable  {
	private static final long serialVersionUID = 1L;

	@Id
	@GeneratedValue(strategy=GenerationType.AUTO)
	@Column(name="Id", unique=true, nullable=false)
	private int id;

	@Column(name="LindenEuros", nullable=false, precision=10)
	private BigDecimal lindenEuros;

	//bi-directional many-to-one association to Lindenmovementstype
    @ManyToOne
	@JoinColumn(name="Type", nullable=false)
	private Lindenmovementstype lindenmovementstype;

	//bi-directional many-to-one association to Balance
    @ManyToOne
	@JoinColumn(name="UserId", nullable=false)
	private Balance balance;

    @Temporal( TemporalType.TIMESTAMP)
    @Column(name="Date", nullable=false)
	private Date date;
    
    public Lindenmovement() {
    }
    
    public Lindenmovement(int id_) {
    	this.id = id_;
    }

	public int getId() {
		return this.id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public BigDecimal getLindenEuros() {
		return this.lindenEuros;
	}

	public void setLindenEuros(BigDecimal lindenEuros) {
		this.lindenEuros = lindenEuros;
	}

	public Lindenmovementstype getLindenmovementstype() {
		return this.lindenmovementstype;
	}

	public void setLindenmovementstype(Lindenmovementstype lindenmovementstype) {
		this.lindenmovementstype = lindenmovementstype;
	}
	
	public Balance getBalance() {
		return this.balance;
	}

	public void setBalance(Balance balance) {
		this.balance = balance;
	}

	public void setDate(Date date) {
		this.date = date;
	}

	public Date getDate() {
		return date;
	}

	@Override
	public Object onCycleDetected(Context arg0) {
		Lindenmovement obj = new Lindenmovement(this.id);
		  
		return obj;  
	}
	
}